﻿<div class="top">
  <h1><?php echo $heading_title;  ?></h1>
</div>
<div class="middle" style="background-image:url('catalog/view/theme/default/image/loginbg.jpg');">
  <?php if ($success) { ?>
  <div class="success"><?php echo $success; ?></div>
  <?php } ?>
  <?php if ($error) { ?>
  <div class="warning"><?php echo $error; ?></div>
  <?php } ?>
  <div style="float: right; display: inline-block; width: 274px;margin-top:70px">
    <div style="background: #F6F9FF; border: 1px solid #DDDDDD; padding: 10px; min-height: 175px;">
      <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="login">
        <?php echo $text_i_am_returning_customer; ?><br />
        <br />
        <b><?php echo $entry_username; ?></b><br />
        <input id="username" type="text" name="username" />
        <br />
        <br />
        <b><?php echo $entry_password; ?></b><br />
        <input id="password" type="password" name="password" /><br />
        
        <!-- Begin add code by D-Ngan July 13 2012-->
   		</br>
        <?php
		 if(!isset($_SESSION['wrong_captcha'])){
			$_SESSION['wrong_captcha']=0;
			}
		if($_SESSION['wrong_captcha'] >4){
			echo '<b>', $entry_captcha, '</b>', '<br/>','<br/>';
			$listDir=explode('/',str_replace('\\','/',DIR_SYSTEM));
			$lastDir=$listDir[count($listDir)-2];
			$relateDir='./'.$lastDir.str_replace('\\','/','\library\captcha');
			$fileCapPath=$relateDir.'/captcha.php';
			if(!file_exists($fileCapPath)){
				exit('Error: Unale to load captcha.php');
			}
			require_once($fileCapPath);
			$capthaOBJ = new Captcha();
			$imgout=$relateDir.'/outimg.jpg';
			$capthaOBJ->OutputCaptcha(100,30,6,$relateDir.'/img.jpg',$imgout);
			echo '<img src="', $imgout ,'"width="100" height="30" /> ';
			echo '<br/>', '<br/>';
			echo '<input id="captcha_valid" type="text" name="captcha_valid" /><br />';
		}
	?>
        
        
       	<!-- End add code by D-Ngan Junly 13 2012-->
        
         <!--<img src="./system/library/captcha/outimg.jpg" width="100" height="30" /><br/>-->
 <!--Start edit login to comment by Le-Minh 02/06/2012-->
	<?php if(isset($_SERVER['HTTP_REFERER'])){
$_SESSION['urlminh'] = $_SERVER['HTTP_REFERER'];}?>
 <!--End edit login to comment by Le-Minh 02/06/2012-->
        <a href="<?php echo $forgotten; ?>"><?php echo $text_forgotten_password; ?></a><br />
        <div style="text-align: right;"><a onclick="$('#login').submit();" class="button"><span><?php echo $button_login; ?></span></a></div>
        <?php if ($redirect) { ?>
        <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
        <?php } ?>
		<a href='<?php echo $continue; ?>'>Bạn chưa có tài khoản?</a>
      </form>
	  <!--Begin edit by Nguyen 15/8/2012-->
	  <!-- Them vao cac button Yahoo, Google, Facebook-->
		<?php
		require_once('config.php');
		?>
		<br />
		<b><?php echo 'Đăng nhập với tài khoản khác:'; ?></b><br />
		<a href="<?php echo  HTTP_SERVER . 'catalog/controller/account/plugin/provider.php?openid_identifier=https://www.google.com/accounts/o8/id' ?>"><img src="catalog/view/theme/default/image/social/google.png" alt="log in with google" height="24" width="24" /></a>
		<a href="<?php echo HTTP_SERVER . 'catalog/controller/account/plugin/provider.php?openid_identifier=https://me.yahoo.com' ?>"><img src="catalog/view/theme/default/image/social/yahoo.png" alt="log in with google" height="24" width="24" /></a>
		<a href="<?php echo HTTP_SERVER . 'index.php?route=account/create' ?>"><img src="catalog/view/theme/default/image/social/facebook.png" alt="log in with google" height="24" width="24" /></a>
		<!--End edit by Nguyen 15/8/2012-->
    </div>
  </div>
</div>
<div class="bottom">&nbsp;</div>
<script type="text/javascript"><!--
$('#username').keydown(function(e) {
	if (e.keyCode == 13) {
		$('#username').focus();
	}
});
$('#passw').keydown(function(e) {
	if (e.keyCode == 13) {
		$('#login').submit();
	}
});
//--></script>